<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <title>后台登录</title>
    <link rel="stylesheet" href="/css/pg_btn.css">
    <script type="text/javascript" src="./js/jquery-1.3.2.min.js"></script>
    <script src="lib/layui/layui.js"></script>
    <script type="text/javascript"   th:inline="none" src="./js/xadmin.js"></script>
</head>
<body>
   <div class="page-bar" id="pg_div">
       <ul class="page-num-ul">
           <li class="pg-li" th:text="'共'+${pi.totalCount}+'条记录&nbsp;&nbsp;'+${pi.pageIndex}+'/'+${pi.pageTotalCount}+'页'">
           <li th:if="${pi.pageIndex>1}">
                <a class="pg_a" th:href="@{javascript:page_nav(document.forms[0],1);}" th:text="首页"></a>
                <a class="pg_a" th:href="@{'javascript:page_nav(document.forms[0],'+${pi.pageIndex-1}+');'}" th:text="上一页"></a>
           </li>
           <li th:if="${pi.pageIndex<pi.pageTotalCount}">
                <a class="pg_a" th:href="@{'javascript:page_nav(document.forms[0],'+${pi.pageIndex+1}+');'}" th:text="下一页"></a>
                <a class="pg_a" th:href="@{'javascript:page_nav(document.forms[0],'+${pi.pageTotalCount}+');'}" th:text="最后一页"></a>
           </li>
           </li>
       </ul>
       <ul class="page-go-form"><label>跳转至</label>
           <input type="text" name="inputPage" id="inputPage" class="page-key" />页
           <button type="button" class="page-btn" onClick='jump_to(document.forms[0],document.getElementById("inputPage").value)'>GO</button>
       </ul>
   </div>
</body>
<script>
    function page_nav(frm,num) {
        frm.pageIndex.value = num;
        frm.submit();
    }

    function  jump_to(frm,num) {
        var  regexp=/^[1-9]\d*$/;
        var  totalPageCount = document.getElementById("totalPageCount").value;
        if (!regexp.test(num)){
            alert("请输入大于0的正整数！")
            return false;
        }else if((num-totalPageCount)>0){
            alert("请输入小于总页数的页码");
            return false;
        }else{
            page_nav(frm,num);
        }

    }
</script>
</html>
